<template>
    <div class="conMain">
        <!--急救单-->
        <!-- <a href="javascript:void(0)" class="first-aid-btn" @click="setFirstAidOrder"><span class="hint">紧急输送<div class="hint-txt">备注:目前该功能在测试中，尚未正式使用。</div></span></a>
		<div class="pop-bg" v-if="isFirstAid" @click="closeFirstAid"></div>
		<div class="pop-wrap first-aid-pop" v-if="isFirstAid">
		  <div class="pop-title first-aid-title">紧急输送</div>
		  <div class="pop-con">
			<div class="input-wrap">
			  <span><em class="red">* </em> 姓名/工号</span>
			  <div><input type="text" class="staff" placeholder="姓名或者工号，必填" v-model="staff" @click="firstAidTxt = ''"/></div>
			</div>
			<div class="input-wrap">
			  <span><em class="red">* </em> 电话</span>
			  <div><input class="mobile" type="number" placeholder="手机号码，必填"  v-model="mobile" @keyup="checkNum" @blur="validatemobile" /></div>
			</div>
			<div class="tips red">{{firstAidTxt}}</div>
			<div class="handle-btn">
			  <button class="btn close-btn" @click="closeFirstAid">取消</button>
			  <button class="btn ok-btn" @click="sureFirstAid">下单</button>
			</div>
			<div class="tips red">注：目前该功能在测试中，尚未正式使用。</div>
		  </div>
		</div> -->
        <!--普通下单-->
        <div class="side-left order-con">
            <h3>下单详情</h3>
            <div class="input-wrap" @click.stop="clickShowClassify()">
                <a href="javascript:void (0)" title="一个病人多项检查" class="more-item" @click="clickShowProjects()"></a>
                <div class="title"><em>* </em>输送类别:</div>
                <input class="con-txt classify"  v-model="classify" @keyup.enter="inputClassifyAbout(classify)"/>
                <div class="clear-btn" v-show="classify != ''" @click="clearInputTxt('classify')">&times;</div>
            </div>
            <div class="input-wrap" @click.stop="clickShowCatalog()">
                <div class="title"><em>* </em>输送项目:</div>
                <input class="con-txt catalog" v-model="catalog" disabled="disabled"/>
            </div>
            <div class="input-wrap" @click.stop="clickShowRoom()">
                <a href="javascript:void (0)" title="切换始末位置" class="toggle-item" @click="clickToggleKs()"></a>
                <div class="title"><em>* </em>起点科室:</div>
                <input class="con-txt start" v-model="starts" disabled="disabled"/>
            </div>
            <div class="input-wrap" @click.stop="clickShowStart()">
                <input type="button" value="重设起点地址"/>
            </div>

            <div class="input-wrap patients">
                <i v-if="$root.$data.cid != 17" :class="['setBad-btn iconfont', needSetBad?'icon-xiaolian':'icon-kulian']" @click="handleTabSetBad"></i>
                <input class="add" type="button" @click="addPatient" value="新增"/>
                <div class="patient-input" v-for="(item,index) in startNotes" :key="index">
                    <input class="startNotes" @click="showPatients(index)" :key="index" :id="'bad'+index" :placeholder="(classify == '病人运送'?'* 床号'+ (index + 1):'床号'+ (index + 1))+'/姓名'" v-model="item.bad"/>
                    <div class="clear-btn" v-show="item.bad != ''" @click="clearStartNotes(index)">&times;</div>
                </div>

            </div>
            <div class="tips">*同时检查多个病人，请点击新增按钮</div>

            <div class="input-wrap" @click.stop="clickShowFinish()">
                <a href="javascript:void (0)" title="切换始末位置" class="toggle-item" @click="clickToggleKs()"></a>
                <div class="title">目 &nbsp;的 &nbsp;地:</div>
                <input class="con-txt end" v-model="finish"/>
                <div class="clear-btn" v-show="finish != ''" @click="clearInputTxt('finish')">&times;</div>
            </div>
            <div class="input-wrap" >
                <div class="title"><em v-if="classify == '病人运送'">* </em>携带设备:</div>
                <span @click="clickShowTackle()" :title="tackle" class="con-txt tackle">{{tackle}}</span>
            </div>
            <div class="input-wrap" @click.stop="selectTab(0)">
                <div class="title">备　　注:</div>
                <input class="con-txt notes" v-model="notes"/>
                <div class="clear-btn" v-show="notes != ''" @click="clearInputTxt('notes')">&times;</div>
            </div>
            <div class="input-wrap">
                <div class="title">下 &nbsp;单 &nbsp;人:</div>
                <input class="con-txt notes" v-model="nurse_name"/>
                <div class="clear-btn" v-show="nurse_name != ''" @click="clearInputTxt('nurse_name')">&times;</div>
            </div>
            <div class="input-wrap">
                <div class="title">预约时间:</div>
                <date-time
                    :date="orderTime"
                    :option="orderOption"
                    :limit="limit"
                    @cancel="cancelTime"
                    @change="setOrderTime"
                ></date-time>
            </div>

            <div class="input-wrap" @click="setAttr"><span class="instancy" :class="{'act':attribute == 3}" value="急单">急单</span></div>
            <div class="input-wrap"><button class="btn" @click="submit()">{{submitTxt}}</button></div>
        </div>
        <div class="side-right noTitle side-right2" v-if="showIndex!=3 && showIndex!=8">
            <div class="select-handle" >
                <a href="javascript:void(0)" class="change-btn" @click="changePl">显示转换</a>
                <div class="search-input">
                    <input type="text" v-if="showIndex==9" placeholder="请输入床号或病人名称" v-model="searchPatient">
                    <input type="text" v-if="showIndex==2" placeholder="请输入输送项目" v-model="searchCatalog">
                </div>
            </div>
            <div :class="['select-wrap',{'horizontal':isHorizontal}]">
                <ul class="itemUl" v-if="showIndex==1">
                    <template v-for="(item, index) in classifyLis">
                        <li
                            :class="['itemLi iconLi', item.id == '' ? 'mtain-active' : '']"
                            v-if="item.title!='物流科'"
                            :key="index"
                            @click="selectClassify(item.id,item.title)"
                        ><em>vertical-align: middle;</em><img :src="item.src" alt=""><span>{{item.title}}</span></li>
                    </template>
                </ul>
                <ul class="itemUl" v-if="showIndex==2">
                    <li class="itemLi" v-for="(item, index) in filterCatalog" :key="index" @click="selectCatalog(item.id,item.title)"><em>vertical-align: middle;</em><span>{{item.title}}</span></li>
                </ul>
                <ul class="itemUl" v-if="showIndex==7">
                    <li class="itemLi" v-for="(item, index) in roomLis" :key="index" @click="selectStartRoom(item.name)"><em>vertical-align: middle;</em><span>{{item.name}}</span></li>
                </ul>
                <!-- 病人列表 -->
                <ul class="itemUl" v-if="showIndex==9">
                    <li class="itemLi" v-for="(item, index) in filteredPatient" :key="index" @click="selectPatient(item)"><em>vertical-align: middle;</em><span>{{item.Name}}{{item.BedNo == ''?'':' 床号:'+item.BedNo}}</span></li>
                </ul>
                <ul class="itemUl iconLi" v-if="showIndex==4">
                    <li :class="[item.isActive ? 'itemLi-active' : '', 'itemLi']" v-for="(item, index) in tackleLis" :key="index" @click="selectTackle(item.title)"><em>vertical-align: middle;</em><img :src="item.src" alt=""><span :style="{fontSize: item.title == '无' ? '21px' : '', marginTop: item.title == '无' ? '0' : ''}">{{item.title}}</span></li>
                </ul>
                <ul class="itemUl" v-if="showIndex==5">
                    <li class="itemLi" @click="submit()"><em>vertical-align: middle;</em><span>确定下单</span></li>
                </ul>
                <ul class="itemUl" v-if="showIndex==6">
                    <li class="itemLi" v-for="(item, index) in finishInput" :key="index" @click="selectFinishInput(item.name)"><em>vertical-align: middle;</em><span>{{item.name}}</span></li>
                </ul>
            </div>
        </div>

        <!-- 搜索结果，用默认的列表方式显示 -->
        <div class="side-right noTitle side-right2" v-if="isShowKsResult">
            <input type="text" v-model="ksValue" placeholder="输入科室名称" class="ks-input" @keyup.enter="searchKs">
            <button type="button" class="sure-btn" @click="searchKs">确定</button>
            <div :class="['select-wrap',{'horizontal':isHorizontal}]">
                <ul class="itemUl" v-if="ksLis.length > 0">
                    <li class="itemLi" :title="item.floor" v-for="item in ksLis" :key="item.id" @click="selectKs(item)"><em>vertical-align: middle;</em><span>{{item.name}}</span></li>
                </ul>
                <div v-else>暂无数据</div>
            </div>
        </div>

        <!-- 地址选择 -->
        <div class="side-right noTitle side-right2" v-if="!isShowKsResult && (showIndex==3 || showIndex==8)">
            <input type="text" v-model="ksValue" placeholder="输入科室名称" class="ks-input" @keyup.enter="searchKs">
            <button type="button" class="sure-btn" @click="searchKs">确定</button>
            <vue-cascader
                :data="addressData"
                :isMulti="isMulti"
                :position="position"
                :backBtnText="btnText"
                :backBtnStyles="backBtnStyles"
                :backBtnHover="backBtnHover"
                :backBtnPosi="backBtnPosi"
                @callback="getFullName"
            />
        </div>

        <div class="confirmBox" v-if="confirmShow==true">
            <div class="confirmTitle" v-if="!isReload">第{{times}}次{{confirmTxt}}</div>
            <div class="confirmTitle" v-if="isReload">最近一次下单失败</div>
            <div class="confirmCont">
                <a href="javascript:void(0)" title="将尝试重新提交一次此订单" @click="sendErrorOrder()">再试一次</a>
                <a href="javascript:void(0)" title="取消提交此订单" @click="cancelSendOrder()">取消下单</a>
            </div>
        </div>
        <div class="orderBox" v-if="orderBoxShow">
            <div class="orderBoxTitle"><span>{{orderBoxText}}</span></div>
            <div class="orderBoxClose" @click="closeOrderBox()">
                <button>已知悉</button>
            </div>
        </div>
        <div v-if="modalShow" class="modal-bg"></div>
        <div v-if="patientShow" class="patientModal">
            <div class="pHead">是否发送</div>
            <div class="pBody">
                <div class="pType">{{classify}} - {{catalog}}</div>
                <div class="pCont">
                    <span class="pTitle">床号 </span>
                    <span class="pNum">
                        <span v-for="(item, index) in startNotes" :key="index" v-if="item.bad != ''">{{item.bad}}, </span>
                    </span>
                </div>
            </div>
            <div class="pBottom">
                <button class="sure" @click="surePatient">确认</button>
                <button class="cancel" @click="closePatient">取消</button>
            </div>
        </div>

        <div v-if="isShowRefundTips" class="modal-bg"></div>
        <div v-if="isShowRefundTips" class="orderBox checkBox">
            <div class="title">温馨提示</div>
            <div class="orderBoxTitle"><span>如有该退费详细信息（如姓名、住院号、约单时间、急退费状态任意一项），方便的话请在备注中告知我们。便于我们更好的为您提供服务，感谢您的支持与信赖O(∩_∩)O。</span></div>
            <div class="orderBoxClose">
                <button class="confirm" @click="submitAjax()">继续提交</button>
                <button class="cancel" @click="closeCheckBox()">返回填写</button>
            </div>
        </div>

        <div v-if="showAffirm" class="modal-bg"></div>
        <div v-if="showAffirm" class="patientModal">
            <div class="pHead">若开启该功能，输送下单将不会强制填写床号。</div>
            <div class="pBottom">
                <button class="sure" @click="handleSureNoSetBad">确认</button>
                <button class="cancel" @click="showAffirm = false">取消</button>
            </div>
        </div>

        <order-projects
            v-if="orderProjectsShow"
            @closeProjects ="closeProjects"
            :starts="starts"
            :classify-lis="proClassifyLis"
            :room-lis="roomLis"
            :parent-room="patientRom"
            :is-horizontal="isHorizontal"
            :set-bad-status="needSetBad"
            @sendsocketfn="sendSocket"
        ></order-projects>

        <order-maintain
            v-if="isShowMtOrder"
            :roomLis="roomLis"
            :start="starts"
            :ispop="true"
            @handleHideModal="hideMtModal"
        ></order-maintain>
    </div>
</template>
<script>
    import dateTimes from '../tips/calendar2.vue'
    import today from '../common/today'
    import common from '../common/com'
    import orderProjects from './order-projects.vue'
    import orderMaintain from './order-maintain.vue'
    import {
        rehabUrl,
        sosUrl,
        classifyUrl,
        catalogInputUrl,
        catalogUrl,
        destinationUrl,
        addressUrl,
        siteNoUrl,
        tackleUrl,
        submitUrl
    } from '../common/ajax'
    export default {
        components:{
            'date-time': dateTimes,
            'order-projects': orderProjects,
            'order-maintain': orderMaintain
        },
        props:{
            start:'',
            roomLis:'',
            repeatId:'',
            todayTime:'',
            needSetBad:'',
            siteAlias:{
                type:Array,
                default:function(){
                    return []
                }
            }
        },
        data(){
            function permutations(){
                let state = localStorage.getItem('-ektFasterArrSt-');
                if(state=='true'){
                    return true
                }else {
                    return false
                }
            }
            return{
                orderProjectsShow: false,
                isHorizontal:permutations(),
                // 多个病人床号
                patientPage: 0,
                patientNum: 2,
                patientShow: false,
                patientData: '',
                // 根据是否为第一次提交判断是不是要生成时间戳
                createTimestamp: true,
                timeStamp: '',
                confirmShow: false,
                modalShow: false,
                orderBoxShow: false,
                orderBoxText: '',
                isReload: false,
                isFirstError: true,
                confirmTxt:'，下单失败',
                times: 1,
                // 本地存储的订单信息
                json: '',
                isUp:true,
                submitTxt:'确定下单',
                //选择的
                classify:'',
                classifyId:'',
                catalog:'',
                catalogId:'',
                startSite:sessionStorage.getItem('preRomm'),
                startNotes: [{bad:''}],
                startNotesIndex: 0,
                starts:'',
                patientRom:'',
                startsSendStatus: 0,
                finish:'',
                tackle:'',
                notes:'',
                orderTime:{
                    time:''
                },
                attribute:1,
                nurse_name: '',
                //
                showIndex:1,
                //列表的
                proClassifyLis: [],
                classifyLis:[],
                catalogLis:[],
                searchCatalog:'',
                tackleLis:[],
                finishInput:[],
                patientLis:[],
                searchPatient:'',
                showAffirm: false,
                //时间
                orderOption:{
                    type: 'min',
                    week: ['一', '二', '三', '四', '五', '六', '日'],
                    month: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
                    format: 'YYYY-MM-DD HH:mm',
                    placeholder: '',
                    inputStyle: {
                        'padding': '0 20px 0 106px'
                    },
                    color: {
                        header: '#46bd9e',
                        headerText: '#fff'
                    },
                    buttons: {
                        ok: '确定',
                        cancel: '取消'
                    },
                    overlayOpacity: 0.5, // 0.5 as default
                    dismissible: true // as true as default
                },
                limit: [
                    {
                        type: 'fromto',
                        from: ''
                    }
                ],
                //急救单
                isFirstAid:false,
                staff:'',
                mobile:'',
                firstAidTxt:'',
                // 地址选择
                addressData: [],
                position: 'middle',
                isMulti: false,
                btnText: '返回',
                backBtnStyles:{
                    background: '#ffd4c6',
                    color: '#fd2b2b'
                },
                backBtnHover:{
                    background: 'red',
                    color: '#fff'
                },
                backBtnPosi:'top',
                fullName: '',
                // 地址搜索
                isShowKsResult: false,
                ksValue:'',
                ksLis: [],
                isShowRefundTips: false, // 显示退单弹窗
                isShowMtOrder: false,
            }
        },
        methods:{

            hideMtModal(){
                this.isShowMtOrder = false;
            },
            searchKs(){
                if(this.ksValue.trim() != ''){
                    this.isShowKsResult = true;
                    this.loadNewAddress()
                }else{
                    this.$Message({type:'error',message:'搜索内容不能为空'});
                }
            },
            selectKs(item){
                let str = `${item.floor} ${item.name}`
                if(this.showIndex == 3) this.finish = str
                if(this.showIndex == 8) this.starts = str
            },
            getFullName(item){
                let str = item.join(' ')
                if(this.showIndex == 3) this.finish = str ,this.skipFn('end')
                if(this.showIndex == 8) this.starts = str ,this.skipFn('')
            },
            closeCheckBox(){
                this.isShowRefundTips = false;
            },
            clickToggleKs(){  // 切换始末位置
                let tmpStart = this.starts,
                    tmpFinish = this.finish;

                this.starts = tmpFinish;
                this.finish = tmpStart;
            },
            //重派
            loadRepeatFn(){
                let _this=this;
                if(_this.repeatId==''){
                    return
                }else {
                    //赋值
                    jQuery.ajax({
                        url: rehabUrl,
                        type:'post',
                        dataType: 'json',
                        cache: false,
                        data:{'oid':_this.repeatId},
                        success: function(data) {
                            if(data.success){
                                let d =data.data;
                                this.classify = d.classifyname;
                                this.classifyId = d.classifyid;
                                this.catalog = d.catalogname;
                                this.catalogId = d.catalogid;
                                this.startNotes[0].bad = d.startbed;
                                this.finish = d.finishaddress;
                                this.tackle = d.tackle;
                                this.notes = d.message;
                                this.$parent.repeatId = '';
                            }else {
                                throwErrorTips('重派，获取订单信息失败',data.msg)
                            }
                        }.bind(this)
                    });
                }
            },
            //急救单
            setFirstAidOrder(){
                this.isFirstAid = true;
                setTimeout(function(){
                    common.inputOutline('.staff');
                }.bind(this),50);
                this.staff = '';
                this.mobile = '';
                this.firstAidTxt = '';
            },
            closeFirstAid(){
                this.isFirstAid = false;
            },
            sureFirstAid(){
                let staff = this.staff.trim();
                if(staff == ''){
                    this.firstAidTxt = '请填写姓名或者工号';
                    common.inputOutline('.staff');
                    return
                }
                let tips = this.validatemobile();
                if(!tips){
                    return
                }
                if(this.start == ''){
                    this.closeFirstAid();
                    this.$Message({type:'error',message:'请选择默认起点地址，再下单'});
                    return
                }
                if(this.isUp == true){
                    this.isUp = false;
                    jQuery.ajax({
                        url: sosUrl,
                        type:'post',
                        dataType: 'json',
                        cache: false,
                        data:{tel:this.mobile,name:staff,startaddress:this.start},
                        success: function(data) {
                            this.isUp = true;
                            if(data.success){
                                this.closeFirstAid();
                            }else {
                                throwErrorTips('',data.msg)
                            }
                        }.bind(this),
                        error:function(){
                            this.isUp = true;
                        }.bind(this)
                    });
                }
            },
            checkNum(){
                let a =  Number(this.mobile);
                if(isNaN(a)){
                    this.mobile ='';
                }
            },
            validatemobile(){
                if(this.mobile.length==0)
                {
                    this.firstAidTxt = '请输入手机号码！';
                    common.inputOutline('.mobile');
                    return false;
                }
                if(this.mobile.length!=11)
                {
                    this.firstAidTxt = '请输入有效的手机号码！';
                    common.inputOutline('.mobile');
                    return false;
                }
                //var myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
                var myreg = /^1[3|4|5|7|8][0-9]{9}$/;
                if(!myreg.test(this.mobile))
                {
                    this.firstAidTxt = '请输入有效的手机号码！';
                    common.inputOutline('.mobile');
                    return false;
                }else {
                    this.firstAidTxt = '';
                    return true
                }
            },
            //切换
            selectTab(index){
                this.isShowKsResult = false;
                this.showIndex=index;
            },
            //类别
            loadClassify(){
                jQuery.ajax({
                    url: classifyUrl,
                    type:'post',
                    dataType: 'json',
                    cache: false,
                    success: function(data) {
                        if(data.success){
                            this.classifyLis = data.data.lis.map(v => {
                                let title = v.title.replace('/', '')
                                Object.assign(v, {
                                    src: `/static/icon_classify/${title}.png`
                                });
                                return v;
                            })
                            this.proClassifyLis = JSON.parse(JSON.stringify(this.classifyLis))
                            // 默认cid=21南院有维修下单，其余没有
                            // if(this.$root.$data.wxCid.indexOf(this.$root.$data.cid) != -1){
                                // this.classifyLis.push({
                                //     count: '0',
                                //     id: '',
                                //     title: '维修下单',
                                //     src: '/static/icon_classify/服务受理-白色.png'
                                // })
                            // }
                        }else {
                            throwErrorTips('获取类别失败',data.msg)
                        }
                    }.bind(this)
                });
            },
            selectClassify(id,name){
                if(id == '' || id == undefined){
                    this.isShowMtOrder = true;
                    return;
                }
                this.classify=name;
                this.classifyId=id;
                if(name != '病人运送') this.tackle = ''
                //显示项目
                this.selectTab(2);

                common.inputOutline('.catalog');
                this.catalog='';
                this.catalogId='';
                //加载关联项目
                this.loadCatalog(id);
            },
            inputClassifyAbout(txt){
                jQuery.ajax({
                    url: catalogInputUrl,
                    type:'post',
                    dataType: 'json',
                    data:{'no':txt},
                    cache: false,
                    success: function(data) {
                        if(data.success){
                            if(!common.isEmptyObject(data.data)){
                                this.classify=data.data.classifytitle;
                                this.classifyId=data.data.classifyid;
                                this.catalog=data.data.catalogtitle;
                                this.catalogId=data.data.catalogid;
                                this.finish = data.data.zd;
                                if((this.startSite != null && this.startSite != '') || this.roomLis.length == 1){
                                    //是否病人运送
                                    this.skipFn(data.data.zd);
                                }else {
                                    common.inputOutline('.start');
                                    this.clickShowRoom();
                                }
                            }else{
                                this.classify='';
                                this.classifyId='';
                                this.catalog='';
                                this.catalogId='';
                                this.finish = '';
                            }
                        }else {
                            throwErrorTips('',data.msg)
                        }
                    }.bind(this)
                });
            },
            clickShowClassify(){
                this.selectTab(1);
            },
            //项目
            loadCatalog(id){
                this.catalogLis = [];
                if(id){
                    jQuery.ajax({
                        url: catalogUrl,
                        type:'post',
                        dataType: 'json',
                        cache: false,
                        data:{'classifyid':id},
                        success: function(data) {
                            if(data.success){
                                this.catalogLis = data.data.lis;
                            }else {
                                throwErrorTips('获取输送项目失败',data.msg)
                            }
                        }.bind(this)
                    });
                }
            },
            selectCatalog(id,name){
                this.catalog = name;
                this.catalogId = id;
                //显示关联地址
                jQuery.ajax({
                    url: destinationUrl,
                    type: 'post',
                    dataType: 'json',
                    data: {'classifyid': this.classifyId, 'catalogid': this.catalogId},
                    cache: false,
                    success: function (data) {
                        if (data.success) {
                            if(data.data.end){
                                this.finish = data.data.end;
                            }
                            if(data.data.start){
                                if(!this.finish){
                                    this.finish = this.starts
                                }
                                this.starts = data.data.start
                            
                            // if(name == '取药'){
                            //     this.clickToggleKs()
                                if((this.startSite != null && this.startSite != '')|| this.roomLis.length == 1){
                                    this.selectTab(5);
                                }else {
                                    this.skipFn('');
                                }
                            }else {
                                if((this.startSite != null && this.startSite != '')|| this.roomLis.length == 1){
                                    this.skipFn(data.data.title);
                                    if(this.classify == '标本运送'){
                                        this.selectTab(5);
                                    }
                                }else {
                                    common.inputOutline('.start');
                                    this.clickShowRoom();
                                }
                            }
                        }else {
                            throwErrorTips('获取关联地址失败',data.msg)
                        }
                    }.bind(this)
                });
            },
            clickShowCatalog(){
                this.selectTab(2);
                //加载关联项目

                this.loadCatalog(this.classifyId);
            },
            //类别选择自动跳转情况
            skipFn(end){
                if(this.classify == '病人运送'){
                    if(this.startNotes.length == 0){
                        common.inputOutline('.startNotes#bad'+this.startNotesIndex);
                        this.selectTab(0);
                    }else {
                        if(end==''){
                            common.inputOutline('.end');
                            this.clickShowFinish();
                        }else {
                            common.inputOutline('.tackle');
                            this.clickShowTackle();
                        }
                    }
                }else {
                    if(end==''){
                        common.inputOutline('.end');
                        this.clickShowFinish();
                    }else {
                        this.showIndex=5
                        jQuery('.btn').focus();
                    }
                }
            },
            //起点科室
            clickShowRoom(){
                if(this.roomLis.length > 1){
                    common.inputOutline('.start');
                    this.selectTab(7);
                }
            },
            selectStartRoom(name){
                this.startSite = name;
                sessionStorage.setItem('preRomm',name);
                var arr = this.start.split(' ');
                this.starts = arr[0] + ' ' + arr[1]  + ' '+ name;
                if(this.$root.$data.lineCid.indexOf(this.$root.$data.cid) != -1 ){
                    this.patientRom = name;
                    this.loadPatients()
                }else if(this.classify == ""){
                    common.inputOutline('.classify');
                    this.selectTab(1);
                }else {
                    if(this.finish == ''){
                        common.inputOutline('.end');
                        this.clickShowFinish();
                    }else {
                        this.skipTackle();
                    }
                }
            },
            loadNewAddress(){
                jQuery.ajax({
                    url: addressUrl,
                    type: 'get',
                    cache: false,
                    success: function(data){
                        if(data.success){
                            if(this.isShowKsResult){     // 当前处于科室搜索状态，找出符合条件的科室数组
                                let arr = []
                                data.data.forEach(v => {
                                    let obj = {}
                                    v.vals.forEach(v2 => {
                                        v2.vals.forEach(v3 => {
                                            if(v3.name.indexOf(this.ksValue) != -1){
                                                obj = Object.assign({}, v3, {
                                                    floor: `${v.name} ${v2.name}`
                                                })
                                                arr.push(obj)
                                            }
                                        })
                                    })
                                })
                                var newData = common.roomMerge(arr, this.$root.$data.cid, 2)
                                if(newData.length == 0) jQuery('.ks-input').eq(0).focus();
                                this.ksLis = newData;
                                this.ksValue = ''
                            }else{
                                var newData = common.roomMerge(data.data, this.$root.$data.cid)
                                this.addressData = newData;
                            }
                        }else {
                            throwErrorTips('获取地址失败',data.msg)
                        }
                    }.bind(this)
                })
            },
            //起点
            clickShowStart(){
                common.inputOutline('.start');
                this.selectTab(8);
                this.loadNewAddress();
            },
            clickShowProjects(){
                this.orderProjectsShow = true
            },
            closeProjects(){
                this.orderProjectsShow = false
            },
            clickShowFinish(){
                this.isShowKsResult = false;
                this.selectTab(3);
                this.loadNewAddress();
            },
            finishInputFn(txt){//终点地址输入
                this.selectTab(6);
                jQuery.ajax({
                    url: siteNoUrl,
                    type:'post',
                    dataType: 'json',
                    data:{'no':txt},
                    cache: false,
                    success: function(data) {
                        if(data.success){
                            if(!common.isEmptyObject(data.data)){
                                this.finish=data.data.qx;
                                this.finishInput = data.data.roomlis;
                            }
                        }else {
                            throwErrorTips('获取地址失败',data.msg)
                        }
                    }.bind(this)
                });
            },
            selectFinishInput(name){
                this.finish=this.finish+name;
                //跳转到设备
                this.skipTackle();
            },
            //
            loadPatients(){
                this.patientLis = [];
                let pr = this.patientRom;
                for(var val of this.siteAlias){
                    if(val.alias == this.patientRom){
                        let pra = [];
                        for(var room of val.room){
                            pra.push(room.name)
                        }
                        pr = pra.join(',')
                    }
                }
                let m = this.$root.$data.hisErrTips[this.$root.$data.cid] || ''
                jQuery.ajax({
                    url: this.$root.$data.lineUrl[this.$root.$data.cid],
                    type:'get',
                    dataType: 'json',
                    cache: false,
                //  timeout:30000,
                    data:{ks:pr},
                    success: function(data) {
                        if(data.success){
                            let nlist = [];
                            if(data.data != '' && data.data != null && data.data.length > 0){
                                for(var val of data.data){
                                    val.BedNo = val.BedNo.substring(val.BedNo.length-3)
                                    nlist.push({BedNo:val.BedNo,Name:val.Name})
                                }
                            }else {
                                nlist = [];
                            }
                            this.patientLis = nlist.sort(function(a,b){
                                return a.BedNo - b.BedNo
                            });
                            this.startNotes = [{bad:''}]
                        }else {
                            this.patientLis = [];
                            this.startNotes = [{bad:''}];

                            throwErrorTips('获取病人列表失败',data.msg,m)
                        }
                    }.bind(this),
                    error:function(xhr){
                        throwErrorTips('获取病人列表失败',xhr.status,m)
                    }
                });
            },
            showPatients(ind){
                if(this.$root.$data.lineCid.indexOf(this.$root.$data.cid) != -1 ) {
                    if(this.patientRom == ''){
                        this.$Message({type:'error',message:'请先选择起点科室'});
                        common.inputOutline('.start');
                        this.clickShowRoom();
                        return
                    }
                    this.selectTab(9)
                }
                this.startNotesIndex = ind;
                setTimeout(function(){
                    common.inputOutline('.startNotes#bad'+ind);
                },300)
            },
            selectPatient(val){
                let b = '';
                if(val.BedNo != ''){
                    b = ' '+ val.BedNo;
                }
                this.startNotes[this.startNotesIndex].bad = val.Name + b;
                common.inputOutline('.classify');
                this.selectTab(1);
            },
            //非病人运送的跳转设备
            skipTackle(){
                if(this.classify!='病人运送'){
                    this.selectTab(5);
                    jQuery('.btn').focus();
                }else {
                    this.clickShowTackle();
                }
            },
            //设备
            loadTackle(){
                jQuery.ajax({
                    url: tackleUrl,
                    type:'post',
                    dataType: 'json',
                    cache: false,
                    success: function(data) {
                        if(data.success){
                            this.tackleLis = data.data.lis.map(v => {
                                    Object.assign(v, {
                                    src: `/static/icon_tackle/${v.title}.png`
                                });
                                return v;
                            })
                            //   this.tackleLis = data.data.lis;
                            if(this.tackle != ' ' && this.classify == '病人运送'){
                                this.tackleLis.forEach(v => {
                                    this.$set(v, 'isActive', false)
                            })

                                let arr = this.tackle.split(' / ')
                                this.tackleLis.forEach(v => {
                                    arr.indexOf(v.title) != -1 ? v.isActive = true : v.isActive = false;
                            })
                            }
                        }else {
                            throwErrorTips('获取携带设备失败',data.msg)
                        }
                    }.bind(this)
                });
            },
            selectTackle(name){
                if(this.classify == '病人运送') {
                    if(name == '无'){
                        this.tackle = name;
                        this.tackleLis.forEach(v => {
                            v.title == name ? v.isActive = true : v.isActive = false;
                    })
                        this.selectTab(5);
                        jQuery('.btn').focus();
                        return;
                    }
                    if(this.tackle == '' || this.tackle == '无'){
                        this.tackle = name;
                        this.tackleLis.forEach(v => {
                            v.title == name ? v.isActive = true : v.isActive = false;
                    })
                    }else{
                        // 判断name是否已在tackleLis当中
                        if(this.tackle.indexOf(name) != -1){
                            let arr = this.tackle.split(' / ');
                            this.tackle = arr.filter(v => v != name).join(' / ')
                            this.tackleLis.forEach(v => {
                                if(v.title == name) v.isActive = false;
                        })
                        }else{
                            this.tackle += ` / ${name}`
                            this.tackleLis.forEach(v => {
                                if(v.title == name) v.isActive = true;
                        })
                        }
                    }
                }else{
                    this.tackle = name;
                    this.selectTab(5);
                    jQuery('.btn').focus();
                }
            },
            clickShowTackle(){
                common.inputOutline('.tackle');
                this.selectTab(4);
                this.loadTackle();
            },
            addPatient(){
                if(this.startNotes.length < 10){
                    this.startNotes.push({bad:''});
                    this.showPatients(this.startNotes.length - 1)
                }
            },
            //时间
            setOrderTime(){
                this.attribute = 2;
            },
            cancelTime(){
                this.orderTime.time = '';
                this.attribute = 1;
            },
            //急单
            setAttr(){
                if(this.attribute == 1){
                    this.attribute = 3;
                    return
                }
                if(this.attribute == 3){
                    this.attribute = 1;
                    return
                }
            },
            // 发送下单请求
            submitAction(jsons){
                jQuery.ajax({
                    url: submitUrl,
                    type:'post',
                    dataType: 'json',
                    cache: false,
                    timeout: 5000,
                    data:{'data':jsons},
                    success: function(data) {
                        this.submitTxt='确定下单';
                        this.isUp=true;
                        if(data.success){
                            this.orderBoxText = '提交成功！输送中心已经收到您的订单，并会马上安排输送员前往，无需电话确认，催单可在查看详情中催单。';
                            this.orderBoxShow = true;
                            this.modalShow = true;
                            this.confirmShow = false;
                            this.createTimestamp = true
                            sessionStorage.removeItem('failedOrder');
                            if(!common.isEmptyObject(data.datat)){
                                let postjson = JSON.parse(jsons);
                                let socketJson = {};
                                socketJson['istobg'] = true;
                                socketJson['uid'] = '';
                                socketJson['type']='1';
                                socketJson['otype']='待分配';
                                socketJson['id'] = String(data.datat.id);
                                socketJson['sn'] = data.datat.sn;
                                socketJson['classify'] = postjson.classifyname;
                                socketJson['catalog'] = postjson.catalogname;
                                socketJson['site']= postjson.startaddr;
                                this.sendSocket(socketJson)
                            }
                            this.clear();
                        } else {
                            this.orderBoxText = data.msg;
                            this.orderBoxShow = true;
                            this.modalShow = true;
                            this.confirmShow = false;
                        }
                        this.isShowRefundTips = false;
                    }.bind(this),
                    error: function(XMLHttpRequest, textStatus) {
                        this.confirmShow = true;
                        this.modalShow = true;
                        this.firstAidTxt = ',下单失败'
                        if(this.isFirstError) {
                            let orderPost = {
                                times: 1,
                                order: this.json
                            }
                            sessionStorage.setItem('failedOrder', JSON.stringify(orderPost));
                        }
                    }.bind(this),
                });
            },
            // 下单验证及确定
            submitAjax(){
                if(this.start == ''){
                    this.$Message({type:'error',message:'请选择默认起点地址，再下单'});
                    return
                }
                if(this.classifyId ==''){
                    common.inputOutline('.classify');
                    this.selectTab(1);
                    this.$Message({type:'error',message:'请选择输送类别'});
                    return
                }
                if(this.catalogId ==''){
                    common.inputOutline('.catalog');
                    this.$Message({type:'error',message:'请选择输送项目'});
                    return
                }
                if(this.startsSendStatus == 0 && (this.startSite == '' || this.startSite == null) && (this.starts == '' || this.starts == null) && this.roomLis.length > 1){
                    this.clickShowRoom();
                    this.$Message({type:'error',message:'请选择输送起点科室'});
                    return
                }
                if(this.starts == ''){
                    this.clickShowRoom();
                    this.$Message({type:'error',message:'请选择输送起点'});
                    return
                }
                //预约时间比较
                if(this.orderTime.time != ''){
                    let compTime = new Date(jQuery.ajax({async: false}).getResponseHeader("Date")).getTime()/1000;
                    let t = today.getTime2(this.orderTime.time) - compTime;
                    if(t <= 0){
                        this.$Message({type:'error',message:'预约时间必须大于现在的时间'});
                        return
                    }else if(t >= 15*24*60*60){
                        this.$Message({type:'error',message:'不能预约超15天'});
                        return
                    }
                }
                if(this.tackle == ''){
                    if(this.classify != '病人运送'){
                        this.tackle = '无'
                    }else {
                        this.clickShowTackle();
                        this.$Message({type:'error',message:'请选择输送设备'});
                        return
                    }
                }
                if(jQuery.trim(this.finish) == ''){
                    this.finish = '等科室医务人员确定'
                }else if(jQuery.trim(this.finish).split(' ').length == 2){
                    this.clickShowFinish()
                    this.$Message({type:'error',message:'请选择完整的目的地'});
                    return
                }
                if(this.isUp==true){
                    this.isUp=false;
                    let json={};
                    // 时间戳
                    json['only'] = (this.timeStamp).toString();
                    if(this.createTimestamp) {
                        var timeStamp = new Date().getTime();
                        json['only'] = timeStamp.toString();
                        this.timeStamp = timeStamp;
                    }
                    json["classifyname"] = this.classify;
                    json["catalogname"] = this.catalog;
                    json["classifyid"] = this.classifyId;
                    json["catalogid"] = this.catalogId;
                    json["startaddr"] = this.starts;
                    json["endaddr"] = this.finish;
                    json["finishbed"] = '';
                    json["message"] = this.notes;
                    json["tackle"] = this.tackle;
                    json["appointment"] = this.orderTime.time;
                    json["attribute"] = String(this.attribute);
                    json["nurse_name"] = this.nurse_name;
                    //去重
                    let newsarr = [];
                    for(var i = 0; i < this.startNotes.length; i++){
                        if(i == 0) newsarr.push(this.startNotes[i]);
                        let bs = false;
                        if(newsarr.length > 0 && i > 0){
                            for(var j = 0; j < newsarr.length; j++){
                                if(newsarr[j].bad == this.startNotes[i].bad){
                                    bs = true;
                                }
                            }
                            if(!bs){ newsarr.push(this.startNotes[i]);}
                        }
                    }
                    this.startNotes = newsarr;
                    let t = 0;
                    for(var bad of this.startNotes){
                        if(jQuery.trim(bad.bad) !=''){
                            t += 1;
                        }
                    }
                    if(t == 0) {
                        if(this.classify == '病人运送'){
                            if(this.needSetBad){
                                common.inputOutline('.startNotes#bad'+this.startNotesIndex);
                                this.$Message({type:'error',message:'请填写床号，方便我们派送'});
                                this.isUp=true;
                                return
                            }else {
                                json["startbed"] = '等医务人员待定';
                            }
                        }else {
                            json["startbed"] = '';
                        }
                        this.submitTxt='提交中...';
                        this.json =  JSON.stringify(json);
                        this.submitAction(this.json);
                    } else if(t == 1) {
                        this.submitTxt='提交中...';
                        for(let val of this.startNotes) {
                            if(val.bad != '') {
                                json["startbed"] = val.bad;
                                this.json =  JSON.stringify(json);
                                this.submitAction(this.json);
                                break;
                            }
                        }
                    } else {
                        this.submitTxt='提交中...';
                        this.modalShow = true
                        this.patientShow = true
                        this.patientData = json
                    }
                }
            },
            submit(){
                if(this.$root.$data.ssOffDuty){
                    //输送下单不在服务时间内
                    this.$Message({type:'error',message:'输送调度不在服务时间内，请改用电话方式联系'});
                    return
                } else {
                    //输送下单在服务时间内
                    //是否没有id/sn订单编号，提交成功需要返回个id/sn？然后再websocket发送消息到后台
                    if((this.classify == '退费' || this.classify == '退单') && (this.catalog == 'ct' || this.catalog == 'mr' || this.catalog == 'CT' || this.catalog == 'MR')){
                        if(sessionStorage.getItem('refundTips') != 0) {
                            this.submitAjax();
                            return;
                        }
                        this.isShowRefundTips = true
                        sessionStorage.setItem('refundTips', 1);
                    } else {
                        this.submitAjax();
                    }
                }
            },
            // 填写多个病人床号
            surePatient(){
                this.patientShow=false;
                for(let i = 0; i < this.startNotes.length; i++) {
                    if(this.startNotes[i].bad != '') {
                        let onlys = Number(this.patientData['only'])+1;
                        this.patientData["startbed"] = this.startNotes[i].bad;
                        this.patientData['only'] = String(onlys);
                        this.json =  JSON.stringify(this.patientData);
                        this.submitAction(this.json);
                    }
                }
            },
            // 下单失败后的处理
            sendErrorOrder(){
                this.isFirstError = false;
                // 判断是否下单失败后重新刷新
                if(this.isReload) {
                    this.reloadSendOrder();
                    return;
                }
                let orderGet;
                if(sessionStorage.failedOrder) {
                    orderGet = JSON.parse(sessionStorage.failedOrder);
                }
                this.firstAidTxt = '提交中…'
                let orderPost = null;
                let t = 0;
                if(orderGet) {
                    t = orderGet.times;
                    t += 1;
                    orderPost = {
                        times: t,
                        order: this.json
                    }
                } else {
                    orderPost = {
                        times: 1,
                        order: this.json
                    }
                }
                this.times = t
                if(t < 4 || t == 0) {
                    sessionStorage.setItem('failedOrder', JSON.stringify(orderPost));
                    this.createTimestamp = false;
                    this.isUp = true;
                    this.submit();
                } else {
                    jQuery.ajax({
                        url: '/kj/cannotreach',
                        type: 'post',
                        cid: this.$root.$data.cid,
                        cache: false,
                        timeout: 1000,
                        success: function(data) {
                            if(data.success){
                                this.orderBoxText = '下单失败，错误信息已发送给开发人员处理!';
                                this.setShowSendOrderStatus();
                            }else {
                                this.orderBoxText = data.msg;
                                this.setShowSendOrderStatus();
                            }
                        }.bind(this),
                        error: function(XMLHttpRequest, textStatus, errorThrown) {
                            this.orderBoxText = '目前网络状况差，请刷新页面后重试！';
                            this.setShowSendOrderStatus();
                        }.bind(this)
                    });
                    this.submitTxt='确定下单';
                    this.isUp = true;
                }
            },
            setShowSendOrderStatus(){
                this.orderBoxShow = true;
                this.confirmShow = false;
                this.modalShow = true;
                this.isFirstError = true;
                sessionStorage.removeItem('failedOrder');
                this.createTimestamp = true;
                if(this.times==4) {
                    this.times = 1
                }
            },
            cancelSendOrder(){
                sessionStorage.removeItem('failedOrder');
                location.reload();
            },
            // 存在未处理订单时重新加载页面所做的处理
            reloadSendOrder(){
                this.isReload = false;
                this.isFirstError = true;
                let orderObj = JSON.parse(JSON.parse(sessionStorage.failedOrder).order);
                this.json = JSON.stringify(orderObj);  // 将localStorage赋值给json
                let starts = '';
                if(this.roomLis.length == 1){
                    starts = this.start;
                }else {
                    let arr = this.start.split(' ');
                    starts = arr[0]+ ' '+arr[1] + ' ' + this.startSite
                }
                jQuery.ajax({
                    url: submitUrl,
                    type:'post',
                    dataType: 'json',
                    cache: false,
                    timeout: 1000,
                    data:{'data':JSON.stringify(orderObj)},
                    success: function(data) {
                        if(data.success){
                            this.orderBoxText = '提交成功!';
                            this.orderBoxShow = true;
                            this.modalShow = true;
                            this.confirmShow = false;
                            if(!common.isEmptyObject(data.datat)){
                                let socketJson = {};
                                socketJson['istobg'] = true;
                                socketJson['uid'] = '';
                                socketJson['type']='1';
                                socketJson['otype']='待分配';
                                socketJson['id'] = String(data.datat.id);
                                socketJson['sn'] = data.datat.sn;
                                socketJson['classify'] = orderObj.classifyname;
                                socketJson['catalog'] = orderObj.catalogname;
                                socketJson['site']= orderObj.startaddr;
                                this.sendSocket(socketJson)
                            }
                            this.clear();
                        } else {
                            this.orderBoxText = data.msg;
                            this.orderBoxShow = true;
                            this.modalShow = true;
                            this.confirmShow = false;
                        }
                        this.submitTxt='确定下单';
                        this.isUp=true;
                        this.confirmBox = false;
                        sessionStorage.removeItem('failedOrder');
                    }.bind(this),
                    error: function(XMLHttpRequest, textStatus, errorThrown) {
                        this.confirmShow = true;
                        this.modalShow = true;
                        this.times = 1
                    }.bind(this)
                });
            },
            closeOrderBox(){
                this.orderBoxShow = false;
                this.modalShow = false;
                this.orderBoxText = '';
            },
            closePatient(){
                this.patientShow = false;
                this.modalShow = false;
                this.submitTxt='确定下单';
                this.isUp = true;
            },
            //显示的本单起点
            setStartSite(){
                if(this.start == ""){
                    this.starts = '';
                }else {
                    var arr = this.start.split(' ');
                    if(this.roomLis.length == 1){
                        this.starts = this.start;
                        if(arr.length > 1){
                            this.patientRom = arr[2]
                        }else {
                            this.patientRom = arr[0]
                        }

                    }else {
                        let room = sessionStorage.getItem('preRomm');
                        if(arr.length > 1){
                            this.starts = arr[0] + ' '+ arr[1] + ' ';
                        }else {
                            this.starts = '';
                        }
                        if(!(room == null || room == '')) {
                            this.starts = this.starts + room;
                            this.patientRom = room
                        }
                    }
                }
            },
            //清空
            clear(){
                this.classify='';
                this.classifyId='';
                this.catalog='';
                this.catalogId='';
                this.startNotes=[{bda:''}];
                this.finish='';
                this.tackle='';
                this.notes='';
                this.orderTime.time = '';
                this.attribute = 1;
                this.startsSendStatus = 0;
                this.selectTab(1);
                this.setStartSite();
            },
            changePl(){
                this.isHorizontal ?
                    this.isHorizontal = false:
                    this.isHorizontal = true;
                localStorage.setItem('-ektFasterArrSt-',this.isHorizontal)
            },
            //清空
            clearInputTxt(val){
                this[val] = '';
                if(val == 'classify'){
                    this.classifyId = '';
                    this.catalog = '';
                    this.catalogId = '';
                    this.finish = '';
                }
            },
            clearStartNotes(ind){
                this.startNotes[ind].bad = ''
            },
            sendSocket(json){
                this.$emit('sendsocket',JSON.stringify(json));
            },
            handleTabSetBad(){
                if(this.needSetBad){
                    this.showAffirm = true
                }else {
                    this.$emit('handletabsetbad','set',true)
                }
            },
            handleSureNoSetBad(){
                this.showAffirm = false;
                this.$emit('handletabsetbad','set',false)
            }
        },
        computed: {
            filteredPatient: function () {
                var search = this.searchPatient;
                if (search) {
                    return this.patientLis.filter(function(product) {
                        return Object.keys(product).some(function(key) {
                            return String(product[key]).toLowerCase().indexOf(search) > -1
                        })
                    })
                }
                return this.patientLis;
            },
            filterCatalog(){
                var search = this.searchCatalog.toLowerCase();
                if (search) {
                    return this.catalogLis.filter(function(product) {
                        return Object.keys(product).some(function(key) {
                            return String(product[key]).toLowerCase().indexOf(search) > -1
                        })
                    })
                }
                return this.catalogLis;
            }
        },
        created() {
            this.loadNewAddress();
            this.loadRepeatFn();
            this.loadClassify();
            setTimeout(function(){
                this.setStartSite();
                // 中山附一
                if(this.$root.$data.lineCid.indexOf(this.$root.$data.cid) != -1 ) {
                    if(this.patientRom == ''){
                        common.inputOutline('.start');
                        this.clickShowRoom();
                    }else {
                        common.inputOutline('.startNotes#bad'+this.startNotesIndex);
                        this.selectTab(9)
                        this.loadPatients();
                    }
                } else {
                    if(this.patientRom == ''){
                        common.inputOutline('.start');
                        this.clickShowRoom();
                    }else {
                        common.inputOutline('.classify');
                    }
                }
                this.limit[0].from = today.tmr2(-1,this.todayTime);
            }.bind(this),400)
            // 检测sessionStorage, 判断是否要重新发单
            if(sessionStorage.failedOrder) {
                this.confirmShow = true;
                this.modalShow = true;
                this.isReload = true;
            }
            sessionStorage.setItem('refundTips', 0);
        }
    }
</script>
<style scoped lang="less">
    .conMain .modal-tips {
        margin-left: -400px;
    }
    .modal-bg {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        background: rgba(0,0,0,.6);
        opacity: .6;
        z-index: 3;
    }
    .confirmBox {
        position: fixed;
        width: 500px;
        top: 30%;
        left: 50%;
        margin-left: -250px;
        border-radius: 6px;
        z-index: 4;
        padding: 0;
        background-color: #eee;
        overflow: hidden;
    .confirmTitle {
        line-height: 80px;
        position: relative;
        background-color: #fff;
        text-align: center;
        font-size: 20px;
        color: red;
    }
    .confirmCont {
        line-height: 80px;
        text-align: center;
    a {
        display: inline-block;
        width: 150px;
        height: 50px;
        padding: 0 20px;
        line-height: 50px;
        font-size: 18px;
        cursor: pointer;
        vertical-align: middle;
        border-radius: 6px;
        text-decoration: none;
        color: #444;
    }
    a:hover {
        background: #ff5016;
        color: #fff;
    }
    }
    }
    .checkBox {
    .orderBoxClose {
    button{
        outline: 0;
    &:hover{
         background-color: #037AC3;
         color: #fff;
     }
    }
    }
    }
    .orderBox {
        position: fixed;
        top: 30%;
        left: 50%;
        width: 500px;
        margin-left: -250px;
        border-radius: 6px;
        font-size: 20px;
        z-index: 4;
        padding: 0;
        overflow: hidden;
        text-align: center;
        background-color: #eee;
    .orderBoxTitle {
        line-height: 34px;
        padding: 10px 20px;
    span {
        text-align: left;
    }
    }
    .orderBoxClose {
        padding-bottom: 25px;
        line-height: 60px;
    button {
        width: 80%;
        height: 40px;
        cursor: pointer;
        font-size: 22px;
    // color: #c5c7ca;
    // border: 1px solid #c5c7ca;
        border-radius: 4px;
        background-color: #fff;
        line-height: 40px;
        border: 1px solid;
    }
    }
    }
    @media screen and (max-width: 1200px) {
        .confirmBox {
            width: 360px;
            margin-left: -180px;
        }
        .confirmBox .confirmTitle {
            line-height: 50px;
            font-size: 18px;
        }
        .confirmBox .confirmCont {
            line-height: 50px;
        }
        .confirmBox .confirmCont a {
            height: 40px;
            line-height: 40px;
            font-size: 18px;
        }
    }
    @media screen and (max-width: 900px) {
        .confirmBox .confirmTitle {
            line-height: 40px;
            font-size: 14px;
        }
        .confirmBox .confirmCont {
            line-height: 40px;
        }
        .confirmBox .confirmCont a {
            height: 36px;
            line-height: 36px;
            font-size: 14px;
        }
    }

</style>
